var $id = document.getElementById("checked17");
var button = document.getElementById("submit");


button.onclick = function() {
    if ($id.checked === false) {
        alert("请勾选认证协议")
        return false
    }
}



$(document).ready(function() {
    $("button").click(function() {
        if ($id.checked === true) {
            var phone22 = document.getElementById('phone22').value
            var name22 = document.getElementById('name22').value
            var photo = document.getElementById('zhaopian_url').value
            var jianli = document.getElementById('chooseUrl').value
            var shenfenzheng = document.getElementById('chooseUrl1').value
            var xueweizheng = document.getElementById('chooseUrl3').value

            //个人简历

            $.ajax({
                url: 'http://192.168.8.109/api/login/personal',
                type: 'post',
                data: {
                    phone: phone22,
                    //真是姓名
                    nickname: name22,
                    //头像
                    head_pic: photo,
                    //个人简历
                    resume: jianli,
                    //身份证
                    id_card: shenfenzheng,
                    //学位证
                    diploma: xueweizheng
                },
                success: function(res) {
                    console.log(res);
                    var status = JSON.parse(res).status
                    showTips(JSON.parse(res).msg, 700, 3);

                    function showTips(content, height, time) {
                        //窗口的宽度  
                        var windowWidth = $(window).width();
                        var tipsDiv = '<div class="tipsClass">' + content + '</div>';

                        $('body').append(tipsDiv);
                        $('div.tipsClass').css({
                            'position': 'absolute',
                            'top': 90 + '%',
                            'left': 50 + '%',
                            'padding': '3px 5px',
                            'background': 'rgba(51, 51, 51, 0.4)',
                            'font-size': 18 + 'px',
                            'margin-left': -50 + 'px',
                            'border-radius': 10 + 'px',
                            'margin-top': -25 + 'px',
                            'line-height': '50px',
                            'text-align': 'center',
                            'width': 'auto',
                            'height': '50px',
                            'color': '#fff',
                            'opacity': '1'
                        }).show();
                        clearTimeout(settimer)
                        var settimer = setTimeout(function() { $('div.tipsClass').remove(); }, (time * 500));
                        content = ''
                        if (status === 1) {
                            setTimeout(function() {
                                window.location = 'companyLogin.html'
                            }, 2000)
                        }
                    }
                },

            })
        }

    });
});